<?php

/**
 * LigneDevisFournisseur filter form base class.
 *
 * @package    SdCommerce
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseLigneDevisFournisseurFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'designation'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'taux_remise'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'taux_tva'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'quantite'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'prix_unitaire_ht'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'montant_ligne_ht'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'montant_ligne_netht' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'montant_ligne_tva'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'montant_ligne_ttc'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'id_article'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Article'), 'add_empty' => true)),
      'id_devis'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DevisFournisseur'), 'add_empty' => true)),
      'id_tva'              => new sfWidgetFormFilterInput(),
      'created_at'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'designation'         => new sfValidatorPass(array('required' => false)),
      'taux_remise'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'taux_tva'            => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'quantite'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'prix_unitaire_ht'    => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'montant_ligne_ht'    => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'montant_ligne_netht' => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'montant_ligne_tva'   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'montant_ligne_ttc'   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'id_article'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Article'), 'column' => 'id')),
      'id_devis'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('DevisFournisseur'), 'column' => 'id')),
      'id_tva'              => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('ligne_devis_fournisseur_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'LigneDevisFournisseur';
  }

  public function getFields()
  {
    return array(
      'id'                  => 'Number',
      'designation'         => 'Text',
      'taux_remise'         => 'Number',
      'taux_tva'            => 'Number',
      'quantite'            => 'Number',
      'prix_unitaire_ht'    => 'Number',
      'montant_ligne_ht'    => 'Number',
      'montant_ligne_netht' => 'Number',
      'montant_ligne_tva'   => 'Number',
      'montant_ligne_ttc'   => 'Number',
      'id_article'          => 'ForeignKey',
      'id_devis'            => 'ForeignKey',
      'id_tva'              => 'Number',
      'created_at'          => 'Date',
      'updated_at'          => 'Date',
    );
  }
}
